/*
 * GPUC
 * 
 * Copyright © 2008 Attila T. Áfra <attila.afra@gmail.com>
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program. If
 * not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _GPUC_KERNEL_H
#define _GPUC_KERNEL_H

#include "Common.h"
#include "Stream.h"

/*------------------------------------------------------------------------------------------------*/

/// Computation kernel
typedef struct GPUC_Kernel_Object *GPUC_Kernel;

/*------------------------------------------------------------------------------------------------*/

GPUC_API GPUC_Kernel
GPUC_Kernel_create(const char *sourceCode);

GPUC_API void
GPUC_Kernel_destroy(GPUC_Kernel kernel);

GPUC_API int
GPUC_Kernel_getMaxOutputStreamCount();

GPUC_API int
GPUC_Kernel_getParameterCount(GPUC_Kernel kernel);

GPUC_API int
GPUC_Kernel_getParameterIndex(GPUC_Kernel  kernel,
                              const char  *parameterName);

GPUC_API const char *
GPUC_Kernel_getParameterName(GPUC_Kernel kernel,
                             int         parameterIndex);

GPUC_API GPUC_Type
GPUC_Kernel_getParameterType(GPUC_Kernel kernel,
                             int         parameterIndex);

GPUC_API int
GPUC_Kernel_getParameterLength(GPUC_Kernel kernel,
                               int         parameterIndex);

GPUC_API void
GPUC_Kernel_setOutputStream(GPUC_Kernel  kernel,
                            GPUC_Stream *streams,
                            int          streamCount);

GPUC_API void
GPUC_Kernel_setInputStream(GPUC_Kernel  kernel,
                           int          parameterIndex,
                           GPUC_Stream *streams);

GPUC_API void
GPUC_Kernel_setInputFloat(GPUC_Kernel  kernel,
                          int          parameterIndex,
                          const float *values);

GPUC_API void
GPUC_Kernel_setInputFloat2(GPUC_Kernel  kernel,
                           int          parameterIndex,
                           const float *values);

GPUC_API void
GPUC_Kernel_setInputFloat3(GPUC_Kernel  kernel,
                           int          parameterIndex,
                           const float *values);

GPUC_API void
GPUC_Kernel_setInputFloat4(GPUC_Kernel  kernel,
                           int          parameterIndex,
                           const float *values);

GPUC_API void
GPUC_Kernel_setInputInt(GPUC_Kernel  kernel,
                        int          parameterIndex,
                        const int   *values);

GPUC_API void
GPUC_Kernel_setInputInt2(GPUC_Kernel  kernel,
                         int          parameterIndex,
                         const int   *values);

GPUC_API void
GPUC_Kernel_setInputInt3(GPUC_Kernel  kernel,
                         int          parameterIndex,
                         const int   *values);

GPUC_API void
GPUC_Kernel_setInputInt4(GPUC_Kernel  kernel,
                         int          parameterIndex,
                         const int   *values);

GPUC_API void
GPUC_Kernel_setInputBool(GPUC_Kernel  kernel,
                         int          parameterIndex,
                         const int   *values);

GPUC_API void
GPUC_Kernel_setInputBool2(GPUC_Kernel  kernel,
                          int          parameterIndex,
                          const int   *values);

GPUC_API void
GPUC_Kernel_setInputBool3(GPUC_Kernel  kernel,
                          int          parameterIndex,
                          const int   *values);

GPUC_API void
GPUC_Kernel_setInputBool4(GPUC_Kernel  kernel,
                          int          parameterIndex,
                          const int   *values);

GPUC_API void
GPUC_Kernel_setInputFloat2x2(GPUC_Kernel  kernel,
                             int          parameterIndex,
                             const float *values);

GPUC_API void
GPUC_Kernel_setInputFloat3x3(GPUC_Kernel  kernel,
                             int          parameterIndex,
                             const float *values);

GPUC_API void
GPUC_Kernel_setInputFloat4x4(GPUC_Kernel  kernel,
                             int          parameterIndex,
                             const float *values);

GPUC_API void
GPUC_Kernel_invoke(GPUC_Kernel kernel);

GPUC_API void
GPUC_Kernel_partialInvoke(GPUC_Kernel           kernel,
                          const GPUC_Rectangle *range);

/*------------------------------------------------------------------------------------------------*/

#endif // _GPUC_KERNEL_H
